home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / appoooh.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  10KB  |  339 lines

  1. /***************************************************************************
  2.  
  3. Appoooh memory map (preliminary)
  4. Similar to Bank Panic
  5.  
  6. driver by Tatsuyuki Satoh
  7.  
  8.  
  9. 0000-9fff ROM
  10. a000-dfff BANKED ROM
  11. e000-e7ff RAM
  12. e800-efff RAM??
  13.  
  14. write:
  15. f000-f01f Sprite RAM #1
  16. f020-f3ff Video  RAM #1
  17. f420-f7ff Color  RAM #1
  18. f800-f81f Sprite RAM #2
  19. f820-fbff Video  RAM #2
  20. fc20-ffff Color  RAM #2
  21.  
  22. I/O
  23.  
  24. read:
  25. 00  IN0
  26. 01  IN1
  27. 03  DSW
  28. 04  IN2
  29.  
  30. write:
  31. 00  SN76496 #1
  32. 01  SN76496 #2
  33. 02  SN76496 #3
  34. 03  MSM5205 address write
  35. 04  bit 0   = NMI enable
  36.     bit 1   = flipscreen
  37.     bit 2-3 = ?
  38.     bit 4-5 = priority
  39.     bit 6   = bank rom select
  40.     bit 7   = ?
  41. 05  horizontal scroll ??
  42.  
  43. Credits:
  44. - Tatsuyuki Satoh: MAME driver
  45.  
  46. ***************************************************************************/
  47.  
  48. #include "driver.h"
  49. #include "vidhrdw/generic.h"
  50.  
  51. extern unsigned char *appoooh_videoram2;
  52. extern unsigned char *appoooh_colorram2;
  53. extern unsigned char *appoooh_spriteram2;
  54.  
  55. void appoooh_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  56. WRITE_HANDLER( appoooh_scroll_w );
  57. WRITE_HANDLER( appoooh_videoram2_w );
  58. WRITE_HANDLER( appoooh_colorram2_w );
  59. WRITE_HANDLER( appoooh_out_w );
  60. int appoooh_vh_start(void);
  61. void appoooh_vh_stop(void);
  62. void appoooh_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  63.  
  64. static unsigned char *adpcmptr = 0;
  65. static int appoooh_adpcm_data;
  66.  
  67.  
  68. static void appoooh_adpcm_int (int num)
  69. {
  70.     if( adpcmptr )
  71.     {
  72.         if( appoooh_adpcm_data==-1)
  73.         {
  74.             appoooh_adpcm_data = *adpcmptr++;
  75.             MSM5205_data_w(0,appoooh_adpcm_data >> 4);
  76.             if(appoooh_adpcm_data==0x70)
  77.             {
  78.                 adpcmptr = 0;
  79.                 MSM5205_reset_w(0,1);
  80.             }
  81.         }else{
  82.             MSM5205_data_w(0,appoooh_adpcm_data & 0x0f );
  83.             appoooh_adpcm_data =-1;
  84.         }
  85.     }
  86. }
  87. /* adpcm address write */
  88. static WRITE_HANDLER( appoooh_adpcm_w )
  89. {
  90.     unsigned char *RAM = memory_region(REGION_SOUND1);
  91.     adpcmptr  = &RAM[data*256];
  92.     MSM5205_reset_w(0,0);
  93.     appoooh_adpcm_data=-1;
  94. }
  95.  
  96.  
  97.  
  98. static struct MemoryReadAddress readmem[] =
  99. {
  100.     { 0x0000, 0x9fff, MRA_ROM },
  101.     { 0xa000, 0xdfff, MRA_BANK1 },
  102.     { 0xe000, 0xe7ff, MRA_RAM },
  103.     { 0xe800, 0xefff, MRA_RAM }, /* RAM ? */
  104.     { 0xf000, 0xffff, MRA_RAM },
  105.     { -1 }    /* end of table */
  106. };
  107.  
  108. static struct MemoryWriteAddress writemem[] =
  109. {
  110.     { 0x0000, 0xdfff, MWA_ROM },
  111.     { 0xe000, 0xe7ff, MWA_RAM },
  112.     { 0xe800, 0xefff, MWA_RAM }, /* RAM ? */
  113.     { 0xf000, 0xf01f, MWA_RAM, &spriteram, &spriteram_size },
  114.     { 0xf020, 0xf3ff, videoram_w, &videoram, &videoram_size },
  115.     { 0xf420, 0xf7ff, colorram_w, &colorram },
  116.     { 0xf800, 0xf81f, MWA_RAM, &appoooh_spriteram2 },
  117.     { 0xf820, 0xfbff, appoooh_videoram2_w, &appoooh_videoram2 },
  118.     { 0xfc20, 0xffff, appoooh_colorram2_w, &appoooh_colorram2 },
  119.     { -1 }    /* end of table */
  120. };
  121.  
  122. static struct IOReadPort readport[] =
  123. {
  124.     { 0x00, 0x00, input_port_0_r },    /* IN0 */
  125.     { 0x01, 0x01, input_port_1_r },    /* IN1 */
  126.     { 0x03, 0x03, input_port_3_r },    /* DSW */
  127.     { 0x04, 0x04, input_port_2_r },    /* IN2 */
  128.     { -1 }    /* end of table */
  129. };
  130.  
  131. static struct IOWritePort writeport[] =
  132. {
  133.     { 0x00, 0x00, SN76496_0_w },
  134.     { 0x01, 0x01, SN76496_1_w },
  135.     { 0x02, 0x02, SN76496_2_w },
  136.     { 0x03, 0x03, appoooh_adpcm_w },
  137.     { 0x04, 0x04, appoooh_out_w  },
  138.     { 0x05, 0x05, appoooh_scroll_w }, /* unknown */
  139.     { -1 }    /* end of table */
  140. };
  141.  
  142.  
  143.  
  144. INPUT_PORTS_START( appoooh )
  145.     PORT_START    /* IN0 */
  146.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY )
  147.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  148.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY )
  149.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY )
  150.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  151.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN1 )
  152.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 )
  153.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON2 )
  154.  
  155.     PORT_START    /* IN1 */
  156.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
  157.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  158.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
  159.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
  160.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
  161.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START1 )
  162.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START2 )
  163.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON2 | IPF_COCKTAIL )
  164.  
  165.     PORT_START    /* IN2 */
  166.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3 )
  167.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 | IPF_COCKTAIL )
  168.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN3 )
  169.     PORT_BIT( 0xf8, IP_ACTIVE_HIGH, IPT_UNKNOWN )    /* probably unused */
  170.  
  171.     PORT_START    /* DSW */
  172.     PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coin_A ) )
  173.     PORT_DIPSETTING(    0x03, DEF_STR( 4C_1C ) )
  174.     PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
  175.     PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
  176.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  177.     PORT_DIPSETTING(    0x07, DEF_STR( 2C_3C ) )
  178.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_2C ) )
  179.     PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
  180.     PORT_DIPSETTING(    0x06, DEF_STR( 1C_4C ) )
  181.     PORT_DIPNAME( 0x18, 0x00, DEF_STR( Coin_B ) )
  182.     PORT_DIPSETTING(    0x18, DEF_STR( 3C_1C ) )
  183.     PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
  184.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  185.     PORT_DIPSETTING(    0x08, DEF_STR( 1C_2C ) )
  186.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) )
  187.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  188.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  189.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet ) )
  190.     PORT_DIPSETTING(    0x40, DEF_STR( Upright ) )
  191.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  192.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Difficulty ) )
  193.     PORT_DIPSETTING(    0x00, "Easy" )
  194.     PORT_DIPSETTING(    0x80, "Hard" )
  195. INPUT_PORTS_END
  196.  
  197.  
  198.  
  199. static struct GfxLayout charlayout =
  200. {
  201.     8,8,    /* 8*8 characters */
  202.     2048,    /* 2048 characters */
  203.     3,    /* 3 bits per pixel */
  204.     { 2*2048*8*8, 1*2048*8*8, 0*2048*8*8 },    /* the bitplanes are separated */
  205.     { 7, 6, 5, 4, 3, 2, 1, 0 },
  206.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  207.     8*8    /* every char takes 8 consecutive bytes */
  208. };
  209.  
  210. static struct GfxLayout spritelayout =
  211. {
  212.     16,16,    /* 8*8 characters */
  213.     512,    /* 512 characters */
  214.     3,    /* 3 bits per pixel */
  215.     { 2*2048*8*8, 1*2048*8*8, 0*2048*8*8 },    /* the bitplanes are separated */
  216.     { 7, 6, 5, 4, 3, 2, 1, 0 ,
  217.       8*8+7,8*8+6,8*8+5,8*8+4,8*8+3,8*8+2,8*8+1,8*8+0},
  218.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  219.       16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8 },
  220.     32*8    /* every char takes 8 consecutive bytes */
  221. };
  222.  
  223. static struct GfxDecodeInfo gfxdecodeinfo[] =
  224. {
  225.     { REGION_GFX1, 0, &charlayout,        0, 32 },
  226.     { REGION_GFX2, 0, &charlayout,     32*8, 32 },
  227.     { REGION_GFX1, 0, &spritelayout,      0, 32 },
  228.     { REGION_GFX2, 0, &spritelayout,   32*8, 32 },
  229.     { -1 } /* end of array */
  230. };
  231.  
  232.  
  233.  
  234. static struct SN76496interface sn76496_interface =
  235. {
  236.     3,    /* 3 chips */
  237.     { 18432000/6, 18432000/6, 18432000/6 },    /* ??? */
  238.     { 30, 30, 30 }
  239. };
  240.  
  241. static struct MSM5205interface msm5205_interface =
  242. {
  243.     1,                    /* 1 chip             */
  244.     384000,                /* 384KHz             */
  245.     { appoooh_adpcm_int },/* interrupt function */
  246.     { MSM5205_S64_4B },    /* 6KHz               */
  247.     { 50 }
  248. };
  249.  
  250.  
  251.  
  252. static struct MachineDriver machine_driver_appoooh =
  253. {
  254.     /* basic machine hardware */
  255.     {
  256.         {
  257.             CPU_Z80,
  258.             18432000/6,    /* ??? the main xtal is 18.432 MHz */
  259.             readmem,writemem,readport,writeport,
  260.             nmi_interrupt,1
  261.         },
  262.     },
  263.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  264.     1,    /* single CPU, no need for interleaving */
  265.     0,
  266.  
  267.     /* video hardware */
  268.     32*8, 32*8, { 0*8, 32*8-1, 1*8, 29*8-1 },
  269.     gfxdecodeinfo,
  270.     32, 32*8+32*8, /* total colors,color_table_len */
  271.     appoooh_vh_convert_color_prom,
  272.  
  273.     VIDEO_TYPE_RASTER,
  274.     0,
  275.     appoooh_vh_start,
  276.     appoooh_vh_stop,
  277.     appoooh_vh_screenrefresh,
  278.  
  279.     /* sound hardware */
  280.     0,0,0,0,
  281.     {
  282.         {
  283.             SOUND_SN76496,
  284.             &sn76496_interface
  285.         },
  286.         {
  287.             SOUND_MSM5205,
  288.             &msm5205_interface
  289.         }
  290.     }
  291. };
  292.  
  293.  
  294.  
  295. /***************************************************************************
  296.  
  297.   Game driver(s)
  298.  
  299. ***************************************************************************/
  300.  
  301. ROM_START( appoooh )
  302.     ROM_REGION( 0x14000, REGION_CPU1 )    /* 64k for code + 16k bank */
  303.     ROM_LOAD( "epr-5906.bin", 0x00000, 0x2000, 0xfffae7fe )
  304.     ROM_LOAD( "epr-5907.bin", 0x02000, 0x2000, 0x57696cd6 )
  305.     ROM_LOAD( "epr-5908.bin", 0x04000, 0x2000, 0x4537cddc )
  306.     ROM_LOAD( "epr-5909.bin", 0x06000, 0x2000, 0xcf82718d )
  307.     ROM_LOAD( "epr-5910.bin", 0x08000, 0x2000, 0x312636da )
  308.     ROM_LOAD( "epr-5911.bin", 0x0a000, 0x2000, 0x0bc2acaa ) /* bank0      */
  309.     ROM_LOAD( "epr-5913.bin", 0x0c000, 0x2000, 0xf5a0e6a7 ) /* a000-dfff  */
  310.     ROM_LOAD( "epr-5912.bin", 0x10000, 0x2000, 0x3c3915ab ) /* bank1     */
  311.     ROM_LOAD( "epr-5914.bin", 0x12000, 0x2000, 0x58792d4a ) /* a000-dfff */
  312.  
  313.     ROM_REGION( 0x0c000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  314.     ROM_LOAD( "epr-5895.bin", 0x00000, 0x4000, 0x4b0d4294 )    /* playfield #1 chars */
  315.     ROM_LOAD( "epr-5896.bin", 0x04000, 0x4000, 0x7bc84d75 )
  316.     ROM_LOAD( "epr-5897.bin", 0x08000, 0x4000, 0x745f3ffa )
  317.  
  318.     ROM_REGION( 0x0c000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  319.     ROM_LOAD( "epr-5898.bin", 0x00000, 0x4000, 0xcf01644d )    /* playfield #2 chars */
  320.     ROM_LOAD( "epr-5899.bin", 0x04000, 0x4000, 0x885ad636 )
  321.     ROM_LOAD( "epr-5900.bin", 0x08000, 0x4000, 0xa8ed13f3 )
  322.  
  323.     ROM_REGION( 0x0220, REGION_PROMS )
  324.     ROM_LOAD( "pr5921.prm",   0x0000, 0x020, 0xf2437229 )     /* palette */
  325.     ROM_LOAD( "pr5922.prm",   0x0020, 0x100, 0x85c542bf )     /* charset #1 lookup table */
  326.     ROM_LOAD( "pr5923.prm",   0x0120, 0x100, 0x16acbd53 )     /* charset #2 lookup table */
  327.  
  328.     ROM_REGION( 0xa000, REGION_SOUND1 )    /* adpcm voice data */
  329.     ROM_LOAD( "epr-5901.bin", 0x0000, 0x2000, 0x170a10a4 )
  330.     ROM_LOAD( "epr-5902.bin", 0x2000, 0x2000, 0xf6981640 )
  331.     ROM_LOAD( "epr-5903.bin", 0x4000, 0x2000, 0x0439df50 )
  332.     ROM_LOAD( "epr-5904.bin", 0x6000, 0x2000, 0x9988f2ae )
  333.     ROM_LOAD( "epr-5905.bin", 0x8000, 0x2000, 0xfb5cd70e )
  334. ROM_END
  335.  
  336.  
  337.  
  338. GAME( 1984, appoooh, 0, appoooh, appoooh, 0, ROT0, "Sega", "Appoooh" )
  339.